package com.cyt.wx.model.po;

import com.cyt.base.util.BaseUtil;
import com.cyt.base.util.DictCode;
import com.cyt.sys.model.po.SysUser;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * 微信模块-公众号管理实体类
 *
 * @author rong yuan
 * @date 2019-8-15 13:39:34
 */
@Data
@NoArgsConstructor
@Table(name = "cyt_wx_account")
public class WxAccount implements Serializable {

    /**
     * 主键ID
     */
    @Id
    private String id;

    /**
     * 用户id
     */
    @Column(name = "user_id")
    private String userId;

    /**
     * 账号类型：1、通用账号，2个人账户
     */
    @Column(name = "account_type")
    private String accountType;

    /**
     * 名称
     */
    @Column(name = "name")
    private String name;

    /**
     * AppId
     */
    @Column(name = "app_id")
    private String appId;

    /**
     * Secret
     */
    @Column(name = "app_secret")
    private String appSecret;

    /**
     * 状态类型:1、正常,2、无效
     */
    @Column(name = "status")
    private String status;

    /**
     * token值
     */
    @Column(name = "access_token")
    private String accessToken;

    /**
     * token有效时间
     */
    @Column(name = "access_token_end_time")
    private Date accessTokenEndTime;

    /**
     * ticket值
     */
    @Column(name = "js_ticket")
    private String jsTicket;

    /**
     * ticket有效时间
     */
    @Column(name = "js_ticket_end_time")
    private Date jsTicketEndTime;

    /**
     * 有效时间
     */
    @Column(name = "expires_in")
    private Integer expiresIn;

    /**
     * 支付秘钥
     */
    @Column(name = "pay_key")
    private String payKey;

    /**
     * 商户号
     */
    @Column(name = "pay_mach_id")
    private String payMachId;

    /**
     * 删除标识
     */
    @Column(name = "remove_tag")
    private String removeTag;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "create_user")
    private String createUser;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    /**
     * 修改人
     */
    @Column(name = "update_user")
    private String updateUser;

    /**
     * 创建对象
     *
     * @param sysUser 当前用户信息
     * @author rong yuan
     * @date 2019-8-15 13:39:34
     */
    public WxAccount(SysUser sysUser) {
        this.id = BaseUtil.uId();
        this.removeTag = DictCode.BASE_REMOVE_TAG_NORMAL;
        this.createTime = new Date();
        this.createUser = sysUser.getId();
        this.updateTime = new Date();
        this.updateUser = sysUser.getId();
    }
}